package xdpm.nhom16.BUS;

import xdpm.nhom16.DAO.MySQLiteHelper;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class DataProvider
{
	private SQLiteDatabase db;
	private static Context context;

	public static Context getContext()
	{
		return context;
	}

	public SQLiteDatabase getDb()
	{
		return db;
	}

	private static DataProvider _instance = null;

	public DataProvider(Context mContext)
	{

		this.context = mContext;
		MySQLiteHelper dbHelper = new MySQLiteHelper(mContext);
		db = dbHelper.getReadableDatabase();
	}

	public static DataProvider getInstance(Context mContext)
	{
		if (_instance == null)
		{
			_instance = new DataProvider(mContext);
		}

		return _instance;
	}
}
